<%@ page import="com.wuming.house.security.SecurityHander" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/3/20
  Time: 18:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>房价管理</title>
    <link rel="stylesheet" href="${allServerPath}static/layui/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${allServerPath}static/layui/css/public.css" media="all"/>
    <script type="text/javascript" src="${allServerPath}static/layui/layui/layui.js"></script>
</head>
<body style="background-color: #f0f2f5;" class="childrenBody">
<div class="layui-fluid wuli-main">
    <div class="layui-row">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>房价信息</legend>
        </fieldset>
        <form class="layui-form" id="housepriceForm">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label" style="width: 100px">城市</label>

                    <div class="layui-input-inline">
                        <input type="text" id="city" name="city" autocomplete="off"
                               class="layui-input" value="${houseprice['city']}">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label" style="width: 100px">新房价格</label>

                    <div class="layui-input-inline">
                        <input type="text" id="newhousePrice" name="newhousePrice" autocomplete="off"
                               class="layui-input" value="${houseprice['newhousePrice']}">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label" style="width: 100px">二手房价格</label>

                    <div class="layui-input-inline">
                        <input type="text" id="secondhousePrice" name="secondhousePrice"
                               autocomplete="off"
                               class="layui-input" value="${houseprice['secondhousePrice']}">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label" style="width: 100px">年</label>

                    <div class="layui-input-inline">
                        <select name="year" id="year">
                            <option value=""></option>
                            <option value="2017">2017</option>
                            <option value="2018">2018</option>
                            <option value="2019">2019</option>
                            <option value="2020">2020</option>
                            <option value="2021">2021</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label" style="width: 100px">月</label>

                    <div class="layui-input-inline">
                        <select name="month" id="month">
                            <option value=""></option>
                            <option value="1">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                            <option value="11">11</option>
                            <option value="12">12</option>
                        </select>
                    </div>
                </div>
            </div>
            <input type="hidden" name="id" value="${houseprice['id']}"/>
        </form>
        <div class="layui-row wuli-button">
            <button class="layui-btn layui-btn-normal" name="btnSave">保存</button>
        </div>
    </div>
</div>

<script>
    layui.use(['layer', 'form', 'jquery'], function () {
        var form = layui.form
            , layer = layui.layer
            , $ = layui.$;

        var year = "${houseprice.year}";
        $("#year").val(year);

        var month = "${houseprice.month}";
        $("#month").val(month);

        form.render();

        $("button[name='btnSave']").on('click', function () {
            $.ajax({
                type: "post",
                //data: $("#housepriceForm").serialize(),
                data:{
                    id : '${houseprice.id}',
                    city:$("#city").val(),
                    newhousePrice:$('#newhousePrice').val(),
                    secondhousePrice:$('#secondhousePrice').val(),
                    year:$('#year option:selected').val(),
                    month:$('#month option:selected').val()
                },
                url: '${allServerPath}web/houseprice/save.htmls',
                success: function (obj) {
                    if (obj.success) {
                        layer.msg("保存成功");
                    }
                }
            });
        });
    });
</script>
</body>
</html>
